package dao.impl;

import dao.DictDAO;
import tools.JDBCTool;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.HashMap;
import java.util.Map;

public class DictDAOImpl implements DictDAO {

    @Override
    public Map<String, String> getJobType() {
        Map<String, String> jobMap = new HashMap<>();
        try{
            Connection conn = JDBCTool.getConnection();
            String sql = "select * from sys_dict where dict_type='job_type'";
            PreparedStatement ps = conn.prepareStatement(sql);
            ResultSet rs = ps.executeQuery();
            while(rs.next()){
                String key = rs.getString("dict_code");
                String value = rs.getString("dict_name");
                jobMap.put(key,value);
            }
            conn.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jobMap;
    }
}
